Skip to content

fix: use consistent rlp encoding for KeyAuthorization#40

Closed
decofe wants to merge 3 commits intomainfrom
klkvr/fix-rlp-encoding
Closed

fix: use consistent rlp encoding for KeyAuthorization#40
decofe wants to merge 3 commits intomainfrom
klkvr/fix-rlp-encoding

Conversation

@decofe
Copy link
Copy Markdown
Member

@decofe decofe commented Apr 2, 2026

Matches the encoding change in tempoxyz/tempo#3443. expiry is no longer encoded as 0x80 when trailing (no limits present). Treats expiry=0 the same as expiry=None.

Prompted by: klkvr

Co-authored-by: Arsenii Kulikov <62447812+klkvr@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d4f6f-abd8-73c6-8b2e-e785405a884a
decofe added a commit that referenced this pull request Apr 3, 2026
- Sync base ABI from tempo-std via tempo_abis.sh --sync
- Add T3 authorizeKey overload + new T3 functions on top (tempo-std
  not yet updated for T3)
- Resolve cherry-pick conflict with PR #40 RLP fix (expiry=0 handling
  already in as_rlp_payload)
- Fix test_inline_key_auth_with_limits: pass SignedKeyAuthorization
  object instead of raw bytes

Co-Authored-By: grandizzy <38490174+grandizzy@users.noreply.github.com>
grandizzy added a commit that referenced this pull request Apr 7, 2026
* feat: add TIP-1011 authorizeKey with KeyRestrictions (T3+)

Add the new authorizeKey(address,uint8,KeyRestrictions) ABI entry and
the CallScope/KeyRestrictions types to IAccountKeychain.json.

Rename the existing authorize_key() to authorize_key_legacy() (pre-T3)
and make authorize_key() use the T3+ KeyRestrictions struct with
allow_any_calls and allowed_calls params.

Co-Authored-By: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com>

* chore: add changelog

* fix: use CallScope type for allowed_calls, export from top-level

Co-Authored-By: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com>

* fix: validate CallScope selector length, document TIP20-only restriction

Co-Authored-By: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com>

* feat: harden keychain type system

* fix: align ABI with current IAccountKeychain interface

- TokenLimit: add period (uint64) field for T3+ overload
- CallScope: use SelectorRule[] instead of flat bytes4
- Add missing functions: setAllowedCalls, removeAllowedCalls,
  getRemainingLimitWithPeriod, getAllowedCalls
- Add AccessKeySpend event
- Fix ruff lint warnings (UP045/UP037)

Co-Authored-By: grandizzy <38490174+grandizzy@users.noreply.github.com>

* fix: sync ABI from tempo-std, fix RLP conflicts, fix integration test

- Sync base ABI from tempo-std via tempo_abis.sh --sync
- Add T3 authorizeKey overload + new T3 functions on top (tempo-std
  not yet updated for T3)
- Resolve cherry-pick conflict with PR #40 RLP fix (expiry=0 handling
  already in as_rlp_payload)
- Fix test_inline_key_auth_with_limits: pass SignedKeyAuthorization
  object instead of raw bytes

Co-Authored-By: grandizzy <38490174+grandizzy@users.noreply.github.com>

* fix: gate authorizeKey test on T3 hardfork detection

The test calls authorize_key() which defaults to T3 ABI. On pre-T3
nodes (testnet/devnet nightly), the T3 selector is rejected. Detect
hardfork and pass legacy=True on T2 nodes.

Co-Authored-By: grandizzy <38490174+grandizzy@users.noreply.github.com>

* fix: detect T3 by probing precompile selector instead of genesis config

The previous approach queried eth_getBlockByNumber for t3Time but that
field is in the chain config, not block data. Instead, probe the
AccountKeychain precompile with the T3 authorizeKey selector (0x980a6025)
and check if it returns UnknownFunctionSelector.

Co-Authored-By: grandizzy <38490174+grandizzy@users.noreply.github.com>

* fix: use TEMPO_HARDFORK env var instead of probing precompile

Read TEMPO_HARDFORK (default T3), use is_t2 fixture to gate legacy ABI.
Pass TEMPO_HARDFORK=T2 in testnet CI workflow.

Co-Authored-By: grandizzy <38490174+grandizzy@users.noreply.github.com>

* fix: bump changelog to major for breaking API change

Co-Authored-By: grandizzy <38490174+grandizzy@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d6690-d702-750b-9b66-34568bdf245d

* chore: sync IAccountKeychain ABI with tempo-std T3 changes

Co-Authored-By: georgen <129292+georgen@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d66a3-f741-70eb-bda2-125c37eab1f5

---------

Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: 0xrusowsky <0xrusowsky@proton.me>
Co-authored-by: grandizzy <38490174+grandizzy@users.noreply.github.com>
Co-authored-by: georgen <129292+georgen@users.noreply.github.com>
Main already incorporates the RLP encoding fix in as_rlp_payload(), so
SignedKeyAuthorization.rlp_encode() delegates to it.

Co-Authored-By: Arsenii Kulikov <62447812+klkvr@users.noreply.github.com>
@klkvr klkvr closed this Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants